/* 
* @Author: zhanshanqin
* @Date:   2016-01-31 15:04:47
* @Last Modified by:  slashhuang
* @Last Modified time: 2016-07-23 00:32:47
*/

'use strict';

$(function(){
    if($('.news-item').children().length==0){
        $('.news-item').html('<div style="text-align: center">抱歉没有相应内容，请重新搜索</div>')
    }



    var isList=$('.main-right').data('index');
    if (isList) return false;

    var obj = $(".hot-news");
    var offsetT = obj.offset().top;
    var offsetL= obj.offset().left;

    var leftH=$('.main-left').height();
    var leftO=$('.main-left').offset().top;

    var mixT=leftH-obj.height()+leftO-88;

    

    if(obj){
        $(document).on('scroll',function(){
            var scrollT=$(document).scrollTop();
            
            if(scrollT > offsetT+112 && scrollT < mixT && $(window).width()>1000 ){
                obj.css({
                    position:'fixed',
                    top:'46px',
                    left:offsetL,
                    right:'auto',
                    bottom:'auto'
                })
            }else if(scrollT > mixT){
                obj.css({
                    position:'absolute',
                    right:0,
                    bottom:0,
                    left:'auto',
                    top:'auto'
                })

            }else{
                obj.css({
                    position:'static'
                })
            }

        })
    }
})
